package main

import (
	"fmt"

	"github.com/hprose/hprose-golang/rpc"
)

type Stub struct {
	Hello      func(string) (string, error)
	AsyncHello func(func(string, error), string) `name:"hello"`
}

func main() {
	client := rpc.NewClient("http://127.0.0.1:8080/")
	var stub *Stub
	client.UseService(&stub)
	stub.AsyncHello(func(result string, err error) {
		fmt.Println(result, err)
	}, "async world")
	fmt.Println(stub.Hello("world"))
}
